$(document).ready(function() {
    $("input#country").autocomplete({
    source: "./ajax/country"
    });
    $("input#region").autocomplete({
        source: "./ajax/region",
        select: function( event, ui ) {
			if (ui.item!=null) {
				$("#country")[0].value=ui.item.country;
				}
			}

        });
    $("input#city").autocomplete({
        source: "./ajax/city",
        select: function( event, ui ) {
			if (ui.item!=null) {
				$("#country")[0].value=ui.item.country;
				$("#region")[0].value=ui.item.region;
				}
			}
        });
    $("#regform").validate();

});